package com.sto.stoapp.activity.sales;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.provider.Contacts;
import android.view.View;
import android.view.View.OnClickListener;

import com.sto.stoapp.activity.R;
import com.sto.stoapp.util.Action;
import com.sto.stoapp.widget.StoHomeActivity;

public class SalesTelphoneSmsActivity extends StoHomeActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sto_sales_telphone_sms);
        Bundle extras = getIntent().getExtras();
        this.setTitleBottom(R.string.telphone_sms, extras.getString("busiType"));
        initListener();
    }

    private void initListener() {
        findViewById(R.id.sto_telphone).setOnClickListener(
                new OnClickListener() {

                    @Override
                    public void onClick(View arg0) {
                        String brand=Build.MODEL;
                        if ("K7".equals(Build.MODEL)) {
                            Intent intent = new Intent();

                            intent.setAction(Intent.ACTION_VIEW);

                            intent.setData(Contacts.People.CONTENT_URI);

                            startActivity(intent);
                        }else if("HT101".equals(Build.MODEL)){
                            Intent intent = getPackageManager().getLaunchIntentForPackage("nci.lhzw.phonefunction");
                            startActivity(intent);
                        }
                        else {
                            Intent intent = new Intent();
                            intent.setAction(Intent.ACTION_CALL_BUTTON);

                            startActivity(intent);
                        }
                    }
                });

        findViewById(R.id.sto_sms).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {

                //e递宝的跳转问题处理
                if("HT101".equals(Build.MODEL)){
                    Intent intent = getPackageManager().getLaunchIntentForPackage("com.lhzw.expressmms");
                    startActivity(intent);
                }else {
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setClassName(Action.SMS_PACKAGE,
                            Action.SMS_DETAIL_PACKAGE);
                    startActivity(intent);
                }
            }
        });
    }


}
